import mylist.MyArrayList;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Scanner;

/**
 * 类的调用者
 */
public class Test {

    public static void main3(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        list.add(10);
        list.add(20);
        list.add(30);
        list.add(0,99);
        //ArrayList<Integer> list2 = new ArrayList<>(15);
        System.out.println(list);
        System.out.println("===================");

        //迭代器
        Iterator<Integer> it = list.iterator();
        while (it.hasNext()) {

        }
        Scanner scanner = new Scanner(System.in);
        scanner.nextInt();





        ArrayList<Number> list3 = new ArrayList<>(list);
        list3.add(88);
        list3.add(66);
        list3.add(77);
        System.out.println(list3);

        list.clear();
        list3.clear();

    }




    public static void main2(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        list.add(10);
        list.add(20);
        list.add(30);
        list.add(0,99);
        ArrayList<Integer> list2 = new ArrayList<>(15);


        //遍历 数组
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }

        //借助toStoring方法遍历打印
        //直接打印会默认调用toString，父类重写了toString方法
        System.out.println(list);

        list.clear();
        list2.clear();
    }





    public static void main1(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        myArrayList.add(1); //0
        myArrayList.add(2); //1
        myArrayList.add(3); //2
        myArrayList.add(3,99);//2
        myArrayList.display();

        //myArrayList.set(2,9999999);
        //myArrayList.display();


        //System.out.println(myArrayList.contains(3));

    }

}
